import requests
from Interface.wechat_po.utils.log_utils import logger


class BaseApi:

    base_url = ""

    def send_api(self, req):
        """
        对requsets 进行二次封装
        :param req:接口对应接口信息
        :return:
        """
        if self.base_url:
            req["url"] = self.base_url + req.get("url")
        logger.info(f"发起接口请求收到的请求数据为?:{req}")
        r = requests.request(**req)
        logger.info(f"发起接口请求收到的请求数据为:{r.text}")
        return r
